import { Injectable } from '@angular/core';
import { ToastController } from '@ionic/angular';
@Injectable({
  providedIn: 'root',
})
export class ToastService {
  public constructor(private toastCtrl: ToastController) {}

  public showInfo(message: string) {
    this.toastCtrl
      .create({
        message,
        duration: 2000,
        position: 'top',
        cssClass: 'custom-toast',
        icon: 'information-circle-outline',
      })
      .then((toastEl) => toastEl.present());
  }
  public showError(message: string) {
    this.toastCtrl
      .create({
        message,
        duration: 3000,
        position: 'top',
        color: 'danger',
        cssClass: 'custom-toast',
        icon: 'information-circle-outline',
      })
      .then((toastEl) => toastEl.present());
  }
}
